<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>修改记录</title>
    <script>
    function  showUserTip2() {
      document.getElementById('userTip2').innerHTML = '<b style="color: lightgray;">课程名不能为空</b>';
    }

    function  checkUser2() {
      var name = document.getElementById('2').value;
      if (name === ''){
        document.getElementById('userTip2').innerHTML = '<b style="color: red">课程名不能为空</b>'
        return 0;
      }else{
        document.getElementById('userTip2').innerHTML = '<b style="color:  green"> ok </b>'
        return 1;
      }
    }

    function  showUserTip3() {
      document.getElementById('userTip3').innerHTML = '<b style="color: lightgray;">总学时不能为空</b>';
    }

    function  checkUser3() {
      var name = document.getElementById('3').value;
      if (name === ''){
        document.getElementById('userTip3').innerHTML = '<b style="color: red">总学时不能为空</b>'
        return 0;
      }else{
        document.getElementById('userTip3').innerHTML = '<b style="color:  green"> ok </b>'
        return 1;
      }
    }

    function  showUserTip4() {
      document.getElementById('userTip4').innerHTML = '<b style="color: lightgray;">总学分不能为空</b>';
    }

    function  checkUser4() {
        var name = document.getElementById('4').value;
        if (name === '') {
            document.getElementById('userTip4').innerHTML = '<b style="color: red">总学分不能为空</b>'
            return 0;
        } else {
            document.getElementById('userTip4').innerHTML = '<b style="color:  green"> ok </b>'
            return 1;
        }
    }
  </script>
</head>
<body>
<h3>请输入要修改记录的相关信息</h3>
<form id="form1" name="form1" method="post" action="/updatewx4">
    <label>课程号：{{data[0]}}
        <input type="hidden" name="stu_id" value='{{data[0]}}'/>
<!--        定义隐藏的输入字段。-->
    </label>
    <p>
        <label>课程名：
            <input type="text" name="stu_name" value='{{data[1]}}'id="2" placeholder="输入课程名" onfocus="showUserTip2()" onblur="checkUser2()"/>
        </label>
        <span id="userTip2"></span>
    </p>
    <p>
    <label>课程类型：
     <select type="text" name="stu_sex">
         <option value ="必修">必修</option>
         <option value ="通选">通选</option>
         <option value ="限选">限选</option>
    </select>
    </label>
    </p>
    <p>
        <label>总学时：
            <input type="text" name="stu_age" value='{{data[3]}}'id="3" placeholder="输入总学时" onfocus="showUserTip3()" onblur="checkUser3()"/>
        </label>
        <span id="userTip3"></span>
    </p>
    <p>
        <label>总学分：
            <input type="text" name="stu_origin" value='{{data[4]}}'id="4" placeholder="输入总学时" onfocus="showUserTip4()" onblur="checkUser4()"/>
        </label>
        <span id="userTip4"></span>
    </p>
    <p>
        <label>
            <input type="submit" name="button" value="提交"/>
        </label>
        <label>
            <input type="reset" name="button2" value="重置"/>
        </label>
        <br/>
    </p>
</form>
</body>
</html>